package com.example.delicioushunter.view.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import com.example.delicioushunter.R;
import com.example.delicioushunter.view.customview.MyText;

public class MaterialOnFoodAdapter extends ArrayAdapter<String> {

	private ArrayList<String> materials_on_food;
	private Context context;

	public MaterialOnFoodAdapter(Context context,
			ArrayList<String> materials_on_food) {
		super(context, R.layout.row_material_on_food, materials_on_food);
		this.context = context;
		this.materials_on_food = materials_on_food;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.row_material_on_food, parent, false);
		MyText txtWhatMaterial = (MyText) rowView.findViewById(R.id.txtWhatMaterial);
		
		txtWhatMaterial.setText(materials_on_food.get(position));
		return rowView;
	}
}
